﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure;

namespace BareWeb.FluentAzureDiagnostics.Tests
{
    [TestClass]
    public class InfrastructureLogsTest
    {
        [TestMethod]
        public void InfrastructureScheduledTransfer_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = TimeSpan.FromDays(1337D);

            var actual = target.Default()
                .TransferInfrastructureLogsEvery(expected)
                .Configuration.DiagnosticInfrastructureLogs.ScheduledTransferPeriod;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void InfrastructureLogsQuota_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = 1337;

            var actual = target.Default()
                .WithInfrastructureLogsQuotaInMBOf(expected)
                .Configuration.DiagnosticInfrastructureLogs.BufferQuotaInMB;

            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void InfrastructureLogsLogLevel_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = Microsoft.WindowsAzure.Diagnostics.LogLevel.Error;

            var actual = target.Default()
                .WhereInfrastructureLogsAreAbove(expected)
                .Configuration.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter;

            Assert.AreEqual(expected, actual);
        }
    }
}
